import request from '@/utils/request'

// 获取播放的 Url
export const getMusicUrlApi = data => {
  return request({
    method: 'POST',
    url: `/song/url?id=${data.id}&cookie=${data.cookie}`
  })
}

// 验证歌曲是否可用
export const getIsSongStatus = data => {
  return request({
    method: 'GET',
    url: `/check/music?id=${data.id}`
  })
}

export const getRecordSong = data => {
  return request({
    method: 'POST',
    url: 'record/recent/song',
    data
  })
}

// 获取歌单详情
export const getPlayListDetail = data => {
  return request({
    method: 'POST',
    url: `/playlist/detail?id=${data.id}&cookie=${data.cookie}`
  })
}
// 获取歌曲详情
export const getSongDetail = data => {
  return request({
    method: 'POST',
    url: `/song/detail?ids=${data.id}&cookie=${data.cookie}`
  })
}

// 搜索建议
export const getSearchSuggset = data => {
  return request({
    method: 'POST',
    url: `/search/suggest?keywords=${data.keywords}&type=mobile`
  })
}

// 搜索单曲
export const searchSongs = data => {
  return request({
    method: 'POST',
    url: `/search?keywords=${data.keyword}&offset=${data.offset}&limit=30&type=${data.type}&timestamp=${data.timestamp}`
  })
}

// 获取歌词
export const getLyric = data => {
  return request({
    method: 'GET',
    url: `/lyric?id=${data.id}`
  })
}
